<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

/**
 * Class CreateDormMeterRecordsTable.
 */
class CreateDormMeterRecordsTable extends Migration
{
	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('dorm_meter_records', function(Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('period_id')->nullable();
            $table->unsignedInteger('dorm_id');
            $table->unsignedInteger('dorm_meter_id');
            $table->unsignedInteger('user_id')->nullable();
            $table->unsignedInteger('client_id')->nullable();
            $table->unsignedInteger('meter_type_id');
            $table->decimal('prev_meter_reading');
            $table->decimal('meter_reading');
            $table->date('meter_reading_date');
            $table->integer('day_span')->nullable();
            $table->decimal('consume');
            $table->string('remark',255)->nullable();
            $table->timestamp('created_at')->useCurrent();
            $table->timestamp('updated_at')->useCurrent();
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('dorm_meter_records');
	}
}
